home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group00b.txt
/
000019_icon-group-sender _Wed Jul 12 16:28:16 2000.msg
< prev
next >
Wrap
Internet Message Format
|
2001-01-03
|
3KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id QAA26521
for icon-group-addresses; Wed, 12 Jul 2000 16:26:12 -0700 (MST)
Message-Id: <200007122326.QAA26521@baskerville.CS.Arizona.EDU>
From: "F.G. van DORP" <F.G.van.Dorp@digimedia.nl>
X-Newsgroups: comp.lang.icon
Subject: Re: Error messages
X-Newsreader: Forte Agent 1.7/32.534
Date: Wed, 12 Jul 2000 20:00:41 GMT
X-Complaints-To: abuse@chello.nl
X-Trace: flipper 963432041 212.187.67.243 (Wed, 12 Jul 2000 22:00:41 MET DST)
To: icon-group@optima.CS.Arizona.EDU
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 2695
On 10 Jul 2000 19:25:27 -0400, Taybin Rutkin <trutkin@black.clarku.edu> wrote:
>On Mon, 10 Jul 2000, Alexandre E. Kopilovitch wrote:
>
>> "Richard A. O'Keefe" <ok@atlas.otago.ac.nz> wrote:
>
>> 1. Notation matters.
>>
>> Suppose that you have to show your Icon program to another person that have
>> no slightest idea about the Icon and Snobol. Surely you will have serious
>
>I think that the paradigm shift from procedural to logical is made easier
>with Icon. The syntax is (and here I'm assuming that you mean operaters
>and keywords and their respective order) much more familiar than
>prolog. I found prolog to be this bizarre alien creature. It was really
>out of my world...
>
>Taybin Rutkin -- trutkin@black.clarku.edu
Actually Prolog is much more similar to Icon than one would suspect:
PROLOG
pred1(P1,P2,P3,R1) :- pred2(P1,P2,R2), pred3(P3,R2,R1).
ICON
procedure pred1(P1,P2,P3)
return (R2:=pred2(P1,P2) & R1:=pred3(P3,R2))
end
This Icon return-expression is a backtracking context and known as
"mutual evaluation" or a "compound conjunction" (and *NOT* a
"compound expression" as I erroneously wrote in one of my previous
postings. Quite the contrary: such expressions, seperated from each
other by semicolons (sometimes implicated, see manual), will not
get resumed if the next in line fails. So the semicolon acts as a "fence"
to backtracking).
The difference between Icon and Prolog lies in the nature of the
procedure/predicate parameters (the P's; R's are the return values).
In Icon these must have a value other than the default NULL value
or else an error message will be generated. In Prolog a parameter
variable can have a value when passed or not, the so-called
"logical variable". An example:
addlist(List1,List2,Newlist)
If List1 and List2 have values when addlist is called, Newlist
returns the sum of List1 and List2. When called with
Newlist and either List1 or List2 with values, addlist returns
the difference list. When called with only Newlist valued,
addlist can generate (through backtracking) all sublist pairs
of Newlist.
There are functional languages with the power of the logical variable,
implemented through a mechanism called "narrowing" (similar to
Prolog's unification). One such language is CURRY
http://www.informatik.uni-kiel.de/~curry/
I doubt if this behavior could be coded in Icon, or even added
to its implementation, should one wish to do so.
Another way is to add a Prolog engine to your program with
an interface to your Icon code,
as mr.LaPalme (lapalme@IRO.UMontreal.CA) managed to do
a while back (see Icon archives).
=====================================================